<html>
<head><meta charset="utf-8"><title>super_relate_consts compare &amp;[u32] · t-compiler/const-eval · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/index.html">t-compiler/const-eval</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/super_relate_consts.20compare.20.26.5Bu32.5D.html">super_relate_consts compare &amp;[u32]</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="202185969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/super_relate_consts%20compare%20%26%5Bu32%5D/near/202185969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/super_relate_consts.20compare.20.26.5Bu32.5D.html#202185969">(Jun 27 2020 at 13:23)</a>:</h4>
<p>Working on <a href="https://github.com/rust-lang/rust/issues/73727">https://github.com/rust-lang/rust/issues/73727</a> I get an ICE in <code>super_relate_consts</code> as comparing  <code>ConstValue::ByRef</code> for references is not yet implemented.</p>



<a name="202186045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/super_relate_consts%20compare%20%26%5Bu32%5D/near/202186045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/super_relate_consts.20compare.20.26.5Bu32.5D.html#202186045">(Jun 27 2020 at 13:25)</a>:</h4>
<p>I think the general idea here is to recursively walk the reference tree and compare any non reference types as normal</p>



<a name="202186124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/super_relate_consts%20compare%20%26%5Bu32%5D/near/202186124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/super_relate_consts.20compare.20.26.5Bu32.5D.html#202186124">(Jun 27 2020 at 13:27)</a>:</h4>
<p>How can I interpret the allocation behind the <code>ConstValue</code> of <code>&amp;[]</code> as <code>[]</code>?</p>



<a name="202186138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/super_relate_consts%20compare%20%26%5Bu32%5D/near/202186138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/super_relate_consts.20compare.20.26.5Bu32.5D.html#202186138">(Jun 27 2020 at 13:27)</a>:</h4>
<p>A slightly simpler case is <code>&amp;'static u32</code>, which currently has the same ICE</p>



<a name="202186197"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/super_relate_consts%20compare%20%26%5Bu32%5D/near/202186197" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/super_relate_consts.20compare.20.26.5Bu32.5D.html#202186197">(Jun 27 2020 at 13:28)</a>:</h4>
<p>where I would like to interpret the allocations as <code>u32</code>  (ConstKind::Value) and compare them</p>



<a name="202186302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/super_relate_consts%20compare%20%26%5Bu32%5D/near/202186302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/super_relate_consts.20compare.20.26.5Bu32.5D.html#202186302">(Jun 27 2020 at 13:30)</a>:</h4>
<p>ah, probably <code>Allocation::read_scalar</code> <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="202186649"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/super_relate_consts%20compare%20%26%5Bu32%5D/near/202186649" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/super_relate_consts.20compare.20.26.5Bu32.5D.html#202186649">(Jun 27 2020 at 13:38)</a>:</h4>
<p>there might be already code which does this to implement match patterns <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span> let's hope that I can reuse that here</p>



<a name="202227796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/super_relate_consts%20compare%20%26%5Bu32%5D/near/202227796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/super_relate_consts.20compare.20.26.5Bu32.5D.html#202227796">(Jun 28 2020 at 09:10)</a>:</h4>
<p>there's <code>const_deref</code>, but we should not fix such ICEs imo unless we go full integer tree constants as per <a href="https://github.com/rust-lang/rust/issues/70889">https://github.com/rust-lang/rust/issues/70889</a></p>



<a name="202227798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/super_relate_consts%20compare%20%26%5Bu32%5D/near/202227798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/super_relate_consts.20compare.20.26.5Bu32.5D.html#202227798">(Jun 28 2020 at 09:10)</a>:</h4>
<p>I think I'll prioritize doing that work as so much stuff is blocked on it</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>